package com.gitee.generator.universal.common;

import cn.hutool.core.text.StrPool;
import freemarker.template.Configuration;
import freemarker.template.Version;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

/**
 * 系统常量 Constants
 * @since 2020-08-19 11:24
 * @author wsx
 */
public class Constants {
    /** 构造方法 */
    private Constants() {}
    static {
        TIME_NOW_INIT = LocalDateTime.now().format(DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS));
        APPLICATION_HOME_DIR = Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("")).getPath();
    }
    /** 当前时间 */
    public static final String TIME_NOW_INIT;
    /** 项目路径 */
    public static final String APPLICATION_HOME_DIR;
    /** 日期格式字符串 */
    public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

    /** 配置字符串 */
    public static final String GENERATOR_CONFIG = "generatorConfig";
    /** 配置字符串 */
    public static final String DB_CONFIG_MAP = "dbConfigMap";
    /** 配置字符串 */
    public static final String PROJECTS = "projects";
    /** 配置字符串 */
    public static final String TABLES = "tables";
    /** 配置字符串 */
    public static final String TABLE = "table";
    /** 配置字符串 */
    public static final String GENERATE = "generate";


    /** 配置 */
    public static final String TEMPLATES = "templates";

    /** tableName */
    public static final String TABLE_NAME = "tableName";

    /** 配置 */
    public static final String OUTPUT = "output";
    /** 方法 */
    public static final String M = "m";

    /** 标点 */
    public static final String POINT = StrPool.DOT;
    /** 标点 */
    public static final String COMMA = StrPool.COMMA;

    /** 模版后缀名 */
    public static final String FTL="ftl";
    /** 模版后缀名 */
    public static final String POINT_FTL=".ftl";
    /** freeMarker 模板版本 */
    public static final Version FREE_MARKER_VERSION = Configuration.VERSION_2_3_31;
}
